package com.htfyun.ft.fragment.engineer;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;

import com.htfyun.ft.R;
import com.htfyun.ft.common.FTUtils;
import com.htfyun.ft.fragment.BaseFragment;
import com.htfyun.ft.fragment.factory.FactoryTestItemsEnum;
import com.htfyun.ft.fragment.factory.ResultAttr;
import com.htfyun.ft.view.recyclerviewflexibledivider.HorizontalDividerItemDecoration;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

/**
 * Created by sst on 2018/7/11.
 */

public class FragmentFTSettings extends BaseFragment
        implements View.OnClickListener {

    private final static String TAG = FragmentFTSettings.class.getSimpleName();


    @Override
    protected int getLayoutRes() {
        return R.layout.fragment_engineer_ft_settings;
    }

    @Override
    protected void onInitView(@Nullable Bundle savedInstanceState) {

        initBtn(R.id.btnAllPass);
        initBtn(R.id.btnAllFail);

    }

    private void initBtn(int resId) {
        View btn = findViewById(resId);
        if (btn != null) {
            btn.setOnClickListener(this);
        }
    }

    @Override
    protected void onVisible() {
        super.onVisible();
    }

    @Override
    public void onClick(View v) {
        final int id = v.getId();
        switch (v.getId()) {
            case R.id.btnAllPass:
                for (FactoryTestItemsEnum item : FactoryTestItemsEnum.values()) {
                    if (item.getItemFragment() != null) {
                        item.setResult(ResultAttr.PASS);
                    }
                }
                break;
            case R.id.btnAllFail:
                for (FactoryTestItemsEnum item : FactoryTestItemsEnum.values()) {
                    if (item.getItemFragment() != null) {
                        item.setResult(ResultAttr.FAIL);
                    }
                }
                break;
        }

    }

}
